package com.rn.simple.loader;

import javax.tools.JavaCompiler;
import javax.tools.ToolProvider;

public class CusJavaCompiler {
    /**
     * @Title: compile
     * @Description: 动态编译java类成成class文件放入指定目录
     * @param: @param expr
     * @param: @param classPath
     * @param: @return
     * @param: @throws Exception
     * @throws
     */
    public static boolean compile(String classPath){
        JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
        int run = compiler.run(null, null, null, classPath);
        return run == 0;
    }

}
